class Association < ActiveRecord::Base
  belongs_to :parent,
    :class_name => 'Vocabulary',
    :foreign_key => 'parent_id'
    
  belongs_to :child, 
    :class_name => 'Vocabulary',
    :foreign_key => 'child_id'
    
  def self.all_associations
    associations = {}
  
    self.find(:all).each do |association|
      associations[association.parent.term] = association.child.term
    end
    
    associations
  end
end
